const express = require('express');
const router = express.Router();
const fileUpload = require('express-fileupload');
// const {
//   login,
//   recognizeIngredients,
//   analyzeNutrition,
//   personalizedRecommendations
// } = require('../controllers/recipeController');
const { login, register, updatePassword } = require('../controllers/userController');
const { getRecipes, getRecipeById, searchRecipes } = require('../controllers/recipeController');
const { recognizeIngredients } = require('../controllers/ingredientController');
const { analyzeNutrition } = require('../controllers/nutritionController');
const { personalizedRecommendations } = require('../controllers/recommendationController');
const { uploadImage } = require('../controllers/uploadController');
const { generateShoppingList } = require('../controllers/shoppingListController');


// 使用 express-fileupload 中间件
router.use(fileUpload());

// 登录路由
router.post('/login', login);

//注册路由
router.post('/register', register);

// 修改密码路由
router.get('/updatePassword', updatePassword);

// 获取所有食谱的路由
router.get('/getRecipes', getRecipes);

// 根据ID获取单个食谱的路由
router.get('/getRecipeById', getRecipeById);

// 搜索功能
router.get('/searchRecipes', searchRecipes);

// 食材识别路由
router.post('/recognizeIngredients', recognizeIngredients);

// 图片上传路由
router.post('/uploadImage', uploadImage);

// 营养分析路由
router.get('/analyzeNutrition', analyzeNutrition);

// 个性化推荐路由
router.get('/personalizedRecommendations', personalizedRecommendations);

//智能生成购物清单路由
router.get('/generateShoppingList', generateShoppingList);


module.exports = router;